package com.platform.modules.wallet.controller;

import com.platform.modules.wallet.service.CallBackService;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * 接口回调控制层
 */
@AllArgsConstructor
@Log4j2
@RestController
@RequestMapping("/callback")
public class CallbackController {

    private final Map<String, CallBackService> callBackMap;

    private CallBackService getBy(String entNum) {
        return callBackMap.get(entNum);
    }

    @PostMapping("/{type}/{business}")
    public Object executeBackProcess(@PathVariable("type") String type, @PathVariable("business") String business,
                                     HttpServletRequest request,
                                     HttpServletResponse response) {
//        Object o = getBy(type).executeBackProcess(business, request, response);
//
//        if (ObjectUtil.isEmpty(o)){
//            return JSONUtil.parseObj("{\"code\":\"500\"}");
//        }
//
//        return o;
        return "测试";
    }

}
